<include file="Public:header_new"/>
<script type="text/javascript" src="__PUBLIC__/Home/js/cityselect.js"></script>
<div class="usermain">
  <!--左侧菜单-->
  <include file="User:left" />
  <!--右侧内容-->
  <div class="assets_content w900 right bg_w">
   <div class="safe_center clear" style="padding-left: 0px; border-bottom: 2px solid #e55600;">
    <h1 style="margin-top: 0px; margin-bottom: 15px; line-height: 15px;">联系地址管理</h1>
   </div>
      <notempty name="prompt_text">
                    <div class="mytips">
                        <h6 style="color: #ff8000;">温馨提示</h6>
                        {$prompt_text}
                    </div>
                </notempty>
   <br>


   <div class="cnyin_record" style="width: 918px;">
    <div class="f_body">
     <div class="f_body_main">
      <div class="f_tab_body">
       <div>
        <table class="f_table" id="investLog_content">
         <thead>
          <tr>
           <th>备注名称</th>
           <th>联系姓名</th>
           <th>身份证号</th>
           <th>联系电话</th>
           <th>详细地址</th>
           <th>添加时间</th>
           <th>操作</th>
          </tr>
         </thead>
         <tbody>
          <volist name="userGoodsList" id="vo">
          <tr>
           <td>{$vo.name}</td>
           <td>{$vo.truename}</td>
           <td>{$vo.idcard}</td>
           <td>{$vo.mobile}</td>
           <td>{$vo.addr}</td>
           <td>{$vo.addtime|addtime}</td>
           <td><a class="cancel" href="javascript:void(0)" onclick="UpdateB({$vo['id']})">删除</a></td>
          </tr>
          </volist>
         </tbody>
        </table>
        <div class="pages">
         <a href="javascript:void(0)" onclick="showA()">添加一个地址</a>
        </div>
       </div>
      </div>
     </div>
    </div>
   </div>
  </div>
</div>
<div class="okcoinPop" id="withdrawCnyAddress" style="display: none;">
 <div class="dialog_content" id="dialog_content_CnyAddress" style="margin-left: -200px; margin-top: 200px; left: 50%; top: 21px;">
  <div class="dialog_title" id="dialog_title_CnyAddress">
   <span id="CnyAddressTitle">添加一个联系地址</span> <a href="javascript:closeAddress();" class="dialog_closed" title="关闭"></a>
  </div>
  <div class="dialog_body center">
   <div style="line-height: 35px; text-align: left; padding-left: 50px;">
    <ul class="PopLayer">
     <li><span class="c2" id="lotteryAmountSpan1">地址备注:</span> <input name="name" id="goods_name" type="text" class="cztxinput" style="width: 200px; padding: 2px; padding-bottom: 5px;"></li>
     <li><span class="c2" id="lotteryAmountSpan2">联系姓名:</span> <input name="name" id="goods_truename" type="text" class="cztxinput" style="width: 200px; padding: 2px; padding-bottom: 5px;"></li>
     <li><span class="c2" id="lotteryAmountSpan3">身份证号:</span> <input name="name" id="goods_idcard" type="text" class="cztxinput" style="width: 200px; padding: 2px; padding-bottom: 5px;"></li>
     <li><span class="c2" id="lotteryAmountSpan4">联系电话:</span> <input name="name" id="goods_mobile" type="text" class="cztxinput" style="width: 200px; padding: 2px; padding-bottom: 5px;"></li>
     <li><span class="c2" id="lotteryAmountSpan5">送货地址:</span> <input name="name" id="goods_addr" type="text" class="cztxinput" style="width: 200px; padding: 2px; padding-bottom: 5px;"></li>
     <li><span class="c2" id="lotteryAmountSpan6">交易密码:</span> <input name="name" id="goods_paypassword" type="password" class="cztxinput" style="width: 100px; padding: 2px; padding-bottom: 5px;"> <a href="/Login/findpaypwd.html" class="reg_floatr">忘记?</a></li>
     <li><a href="javascript:void(0)" onclick="Update()" class="btn" id="btn" style="">立 即 添 加</a></li>
    </ul>
   </div>
  </div>
 </div>
</div>
<div id="dialogBoxShadow" style="position: absolute; top: 0px; left: 0px; z-index: 100; background-color: rgb(0, 0, 0); opacity: 0.4; width: 100%; background-position: initial initial; background-repeat: initial initial; display: none;"></div>
<br>
<br>
<script>

$("#qianbao_type").change(function(){
	var coin=$("#qianbao_type option:selected").val();
	window.location='/User/qianbao/coin/'+coin+'.html';
});


	var coin="{$xnb}";


	$("#city_1").citySelect({nodata:"none",required:false});

	$('#dialogBoxShadow').height($(document).height());
	function closeAddress(){
		$("#withdrawCnyAddress").hide();
		$("#dialogBoxShadow").hide();
	}
	function showA(){
		$("#withdrawCnyAddress").show();
		$("#dialogBoxShadow").show();
	}
	function Update(){
		var name=$('#goods_name').val();
		var truename=$('#goods_truename').val();
		var idcard=$('#goods_idcard').val();
		var mobile=$('#goods_mobile').val();
		var addr=$('#goods_addr').val();
		var paypassword=$('#goods_paypassword').val();
		
		
		if(name==""||name==null){
			layer.tips('请输入备注名称','#goods_name',{tips:3});
			return false;
		}
		if(truename==""||truename==null){
			layer.tips('请输入联系姓名','#goods_truename',{tips:3});
			return false;
		}
		if(mobile==""||mobile==null){
			layer.tips('请输入联系电话','#goods_mobile',{tips:3});
			return false;
		}
		if(idcard==""||idcard==null){
			layer.tips('请输入身份证号','#goods_idcard',{tips:3});
			return false;
		}
		
		if(addr==""||addr==null){
			layer.tips('请输入联系地址','#goods_addr',{tips:3});
			return false;
		}
		if(paypassword==""||paypassword==null){
			layer.tips('请输入交易密码','#goods_paypassword',{tips:3});
			return false;
		}
		
		
		$.post("{:U('User/upgoods')}",{name:name,truename:truename,mobile:mobile,addr:addr,idcard:idcard,paypassword:paypassword},function(data){
			if(data.status==1){
				layer.msg(data.info,{icon:1});
				window.location="{:U('User/goods')}";
			}else{
				layer.msg(data.info,{icon:2});
				if(data.url){
					window.location=data.url;
				}
			}
		},"json");
	}
	
	function UpdateB(id){
		layer.config({
            extend: 'extend/layer.ext.js'
        });
		layer.ready(function () {
			//默认prompt
			layer.prompt({ 
				title: '输入交易密码，并确认',
                formType: 1},function(val){
                	if (val) {
                        //需要执行的方法
                		$.post("{:U('User/delgoods')}",{id:id,paypassword:val},function(data){
                			if(data.status==1){
                				layer.msg(data.info,{icon:1});
                				window.location="{:U('User/goods')}";
                			}else{
                				layer.msg(data.info,{icon:2});
                				if(data.url){
                					window.location=data.url;
                				}
                			}
                		},"json");
                        
                        
                    };
			});
			
		});
		
		
	}
	
	
</script>
<script>
	//菜单高亮
	$('#user_box').addClass('active');
	$('#user_goods').addClass('active');
    $('#user_goods i').attr('class','coin_menu_op_13');
</script>
<include file="Public:footer_new" />